﻿namespace System.ServiceModel.DomainServices.Client
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using System.Runtime.Serialization;

    [DataContract(Name="QueryResultOf{0}", Namespace="DomainServices")]
    public sealed class QueryResult<T> : QueryResult
    {
        public QueryResult()
        {
        }

        public QueryResult(IEnumerable<T> results)
        {
            this.RootResults = results;
        }

        public QueryResult(IEnumerable<T> results, int totalCount)
        {
            this.RootResults = results;
            base.TotalCount = totalCount;
        }

        public override IEnumerable<object> GetIncludedResults()
        {
            return (this.IncludedResults ?? ((IEnumerable<object>) new object[0]));
        }

        public override IEnumerable<object> GetRootResults()
        {
            return (this.RootResults ?? ((IEnumerable<T>) new T[0])).Cast<object>();
        }

        [DataMember(EmitDefaultValue=false)]
        public IEnumerable<object> IncludedResults
        {
            [CompilerGenerated]
            get
            {
                return this.<IncludedResults>k__BackingField;
            }
            [CompilerGenerated]
            set
            {
                this.<IncludedResults>k__BackingField = value;
            }
        }

        [DataMember(EmitDefaultValue=false)]
        public IEnumerable<T> RootResults
        {
            [CompilerGenerated]
            get
            {
                return this.<RootResults>k__BackingField;
            }
            [CompilerGenerated]
            set
            {
                this.<RootResults>k__BackingField = value;
            }
        }
    }
}

